package com.wayhome.srpingbootmybatis.kafka;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/kafka")
public class KafkaTestController {

    @Autowired
    private KafkaProducer kafkaProducer;

    @PostMapping(value = "/sendMessage")
    public String sendMessage(@RequestBody KafkaMessage kafkaMessage) {
        kafkaProducer.sendMessage("doc_close_topic", kafkaMessage.getMessage());
        return "success";
    }
}
